<%@page import="forms.*, java.util.*" %>

<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
<%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %>
<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %>
<%@ page import="javax.sql.*, model.*"%>

<%@ page isELIgnored ="false" %> 

<html:html>

<font size="6">Your Application</font>
<p>

<body>

	<%
	RowSet crsAppInfo = (RowSet)request.getAttribute("crsAppInfo");
	RowSet crsDegInfo = (RowSet)request.getAttribute("crsDegInfo");
	
	int currentAppID = ApplicationModel.getAppid(request.getUserPrincipal().getName());
	String status = SubmissionModel.getApplicationStatusFor(currentAppID);

	crsAppInfo.next();
	%>
	You have already submitted an application.
	<p>
	The status of your application is: <%=status %>
	<p>
	This is the information from your application.
	<br>
	<a href="/CSE135_Project_struts/login/invalidate.jsp">Log out.</a>
	<p>
	
	<ul style="list-style:none; margin: 0px;"> 
        <li><b>First Name: </b><%=crsAppInfo.getString("first_name")%> </li> 
        <li><b>Middle Name: </b><%=crsAppInfo.getString("middle_initial")%> </li>
        <li><b>Last Name: </b><%=crsAppInfo.getString("last_name")%></li>
    </ul> <br>
    
    <b>Country of citizenship: </b><%=crsAppInfo.getString("citizenship")%> <br>
    <b>Country of residence: </b><%=crsAppInfo.getString("residence")%> <br>
    
    <p>
    <b>Address: </b><%=crsAppInfo.getString("street_address")%> <br>
    <b>City: </b><%=crsAppInfo.getString("city")%> <br>
    
    <%
    // if "state" is NOT null, means they came from addressPage directly, means they ARE a US citizen
    if (crsAppInfo.getString("citizenship").equals("United States"))  {
    	out.println ("<b>State: </b>" + crsAppInfo.getString("state_code"));
    }
    // else means they came from residencyPage, means they ARE NOT a US citizen
    else  {
    	out.println ("<b>Country Code: </b>" + crsAppInfo.getString("state_code"));
    }
    %>
    
    <br>
    <b>Zip Code: </b><%=crsAppInfo.getString("zip_code")%> <br>
    <b>Area Code: </b><%=crsAppInfo.getString("area_code")%> <br>
    <b>Telephone Number: </b><%=crsAppInfo.getString("phone_number")%>
    
    <p>
    
    <% while(crsDegInfo.next()){%>
	
	<br>
	<b>Location of university: </b>  <%=crsDegInfo.getString("location")%>
    <br>
    <b>University name: </b> <%=crsDegInfo.getString("university")%> <br>
    
    
    <b>Major: </b> <%=crsDegInfo.getString("major")%>
    <br>
    <b>Degree title: </b><%=crsDegInfo.getString("degree_title")%>
    <br>
    <b>Month: </b><%=crsDegInfo.getString("month")%>
    <br>
    <b>Year: </b><%=crsDegInfo.getString("year")%>
    <br>
    <b>GPA: </b><%=crsDegInfo.getString("gpa")%>
    <p>
    <% 
    }%>
	
	<b>Specialization: </b> <%=crsAppInfo.getString("specialization")%><p>
	
	

</body>
</html:html>